package com.rdc.qingkou.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

import com.rdc.qingkou.Application.MyApplication;



public class DirectedLoginUtil {
    public static void setAccount(String account,String password){
        SharedPreferences .Editor editor = MyApplication.getContext().getSharedPreferences("account",Context.MODE_PRIVATE).edit();
        editor.putString("account",account);
        editor.putString("password",password);
        editor.apply();

    }

    public static boolean checkIsLogined(){
        boolean isLogined = false;
        SharedPreferences sharedPreferences = MyApplication.getContext().getSharedPreferences("account",Context.MODE_PRIVATE);
        String account = sharedPreferences.getString("account","");

        if (!TextUtils.isEmpty(account)){
            isLogined = true;
        }
        return isLogined;
    }

    public static String getAccount(){
        SharedPreferences sharedPreferences = MyApplication.getContext().getSharedPreferences("account",Context.MODE_PRIVATE);
        String account = sharedPreferences.getString("account","");
        return account;

    }

    public static String getPassword(){
        SharedPreferences sharedPreferences = MyApplication.getContext().getSharedPreferences("account",Context.MODE_PRIVATE);
        String password = sharedPreferences.getString("password","");
        return password;

    }
}
